{template 'common/header'}
<ul class="nav nav-tabs">
	<li {if $_GPC['op']=='display' || $_GPC['op']==''}class="active"{/if}><a href="{php echo $this->createWebUrl('order', array('op'=>'display'));}">运单列表</a></li>
	<li><a href="{php echo $this->createWebUrl('order', array('op'=>'edit'));}">添加运单</a></li>
</ul>
 <div class="panel panel-info">
	    <div class="panel-heading">筛选</div>
	    <div class="panel-body">
            <form action="./index.php" method="get" class="form-horizontal" role="form" id="form1">
                <input type="hidden" name="c" value="site" />
                <input type="hidden" name="a" value="entry" />
                <input type="hidden" name="m" value="ew_delivery" />
                <input type="hidden" name="do" value="order" />
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">订单编号</label>
                    <div class="col-sm-8 col-lg-9 col-xs-12">
                        <input class="form-control" name="orderId" id="" type="text" value="{$_GPC['orderId']}" placeholder="请输入订单编号">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">运单信息</label>
                    <div class="col-sm-8 col-lg-9 col-xs-12">
                        <input class="form-control" name="info" id="" type="text" value="{$_GPC['info']}" placeholder="请输入品名或寄收件人姓名或电话">
                    </div>
                </div>

                <div class="form-group">
                        <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">创建时间</label>
                        <div class="col-sm-5 col-lg-7 col-xs-12">
                           {php echo tpl_form_field_daterange('time', array('starttime'=>date('Y-m-d H:i:s', $starttime),'endtime'=>date('Y-m-d H:i:s', $endtime)),true);}
                        </div>
                        <div class="col-sm-3 col-lg-2" style="text-align:right;"><button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
                        </div>
                    </div>
                <div class="form-group">
                </div>
            </form>
	    </div>
	</div>
	<!--
    	作者：916345570@qq.com
    	时间：2016-01-11
    	描述：商品列表
    -->
	{if $_GPC['op']=='display' || $_GPC['op']==''}
	<div class="panel panel-default">
		<div class="panel-heading">商品列表</div>
		<div class="panel-body">
			<div class="table-responsive panel-body">
				<table class="table table-hover table-bordered" style="min-width: 300px;" >
					<thead class="navbar-inner" style="">
						<tr >
							<th style="width:100px;text-align: center;">订单编号</th>
							<th style="width:100px;text-align: center;">唛头</th>
							<th style="width:100px;text-align: center;">物品名称</th>
							<th style="width:50px;text-align: center;">件数</th>
							<th style="width:40px;text-align: center;">计费重量(元/kg)</th>
							<th style="width:100px;text-align: center;">寄件人名称/电话/地址</th>
							<th style="width:100px;text-align: center;">收件人名称/电话/地址</th>
							<th style="width:100px;text-align: center;">创建时间</th>
							<th style="width:200px;text-align: center;">操作</th>
						</tr>
					</thead>
					<tbody style="text-align: center;">
						{loop $orders $order}
						<tr>
							<td>{$order['orderId']}</td>
							<td>{$order['mark']}</td>
							<td>{$order['name']}</td>
							<td>{$order['num']}</td>
							<td>{$order['weight']}</td>
							<td>{$order['sender']}</br>{$order['smobile']}</br>{$order['saddress']}</td>
							<td>{$order['receiver']}</br>{$order['rmobile']}</br>{$order['raddress']}</td>
							<td>{php echo date('Y-m-d H:i' , $order['createdAt']);}</td>
							<td>
								<a href="javascript:#" data-url="{php echo $this->createWebUrl('order', array('id'=>$order[id] , 'op' => 'delete'))}" class="btn btn-default btn-sm delete" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="删除"><i class="fa fa-times"></i>
								</a>
								<a href="{php echo $this->createWebUrl('order', array('id'=>$order['id'] , 'op' => 'edit'));}" class="btn btn-default" data-toggle="tooltip" data-placement="top" title="" data-original-title="编辑"><i class="fa fa-pencil"></i></a>
								<!-- <a href="{php echo $this->createWebUrl('showperiod', array('gid'=>$order['id']));}" class="btn btn-success btn-sm" data-original-title="" title="">编辑详情</a> -->
								<a href="{php echo $this->createWebUrl('detail', array('oid'=>$order['id'] , 'op' => 'display'));}" class="btn btn-success btn-sm" data-original-title="" title="">编辑详情</a>
							</td>
							</td>
							</td>
						</tr>
						{/loop}
						{if empty($orders)}
						<tr>
							<td colspan="9">
								尚未添加运单
							</td>
						</tr>
						{/if}
					</tbody>
				</table>
				{$pager}
			</div>
		</div>
	</div>
	{/if}

<script>
    $('.delete').click(function(event) {
        var url = $(this).attr('data-url');
        if(confirm('确认删除？')){
           $.get(url , function(result){
                    if(result.status == 1){
                        util.message(result.msg,'','success')
                        setTimeout(
                                "window.location.reload()",
                                2000,
                            );
                    }else{
                        util.message(result.msg,'','error');
                    }
                }
                ,"json"
            );
        }else{
            return false;
        }
    });
</script>
{template 'common/footer'}